package com.lib.krismile.ui.main;

import android.os.Handler;
import android.view.Gravity;
import android.view.View;

import androidx.core.content.ContextCompat;
import androidx.lifecycle.ViewModelProvider;

import com.blankj.utilcode.util.ToastUtils;
import com.hjq.bar.OnTitleBarListener;
import com.lib.krismile.R;
import com.lib.krismile.aop.SingleClick;
import com.lib.krismile.base.BaseActivity;
import com.lib.krismile.databinding.ActivityMainBinding;


public class MainActivity extends BaseActivity<ActivityMainBinding, MainViewModel> {

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initViewModel() {
        //初始化创建当前页面的ViewModel
        mViewModel = new ViewModelProvider(this).get(MainViewModel.class);
    }

    @Override
    protected void bindViewModel() {
        //设置 ViewModel 绑定到 xml中 data标签中
        mDataBinding.setViewModel(mViewModel);
    }

    @Override
    protected void init() {
        //假装获取网络请求
        mViewModel.setTestMvvmText();

    }

    @Override
    public void setTitle(CharSequence title) {
        super.setTitle(title);
    }

    @Override
    protected void initListener() {
        super.initListener();
    }

    @Override
    protected boolean isSupportLoad() {
        return true;
    }

    @SingleClick
    @Override
    public void onClick(View view) {
        super.onClick(view);
    }

    @Override
    public void onLeftClick(View view) {
        ToastUtils.make().setGravity(Gravity.CENTER,0,0).setBgColor(ContextCompat.getColor(this,R.color.color_1967d2)).show("ssdsds");
    }
}